import axios from "axios";

import {BackendPageModel} from "@/models/BackendPageModel";
import MaterialModel from "@/models/MaterialModel";

export function getMaterial(search: string, pageNumber = 0, pageSize = 10): Promise<BackendPageModel<MaterialModel>> {
    return new Promise((resolve, reject) => {
        axios({
            method: 'get',
            url: '/api/mat/page',
            params: {pageSize, pageNumber: pageNumber - 1, search}
        }).then(value => {
            resolve(value.data);
        }).catch(reason => {
            console.log(reason);
            reject();
        })
    })
}
